package tw.proxy;

import tw.proxy.dynamicProxy.ProxyHandler;
import tw.proxy.staticProxy.Proxy;
import tw.proxy.staticProxy.RealSubject;

public class ProxyTest {
    public static void main(String[] args) {
        //静态代理
        Subject staticSubject = new Proxy();
        staticSubject.operate();
        //动态代理
        Subject dynamicSubject = (Subject) new ProxyHandler().newProxyInstance(new RealSubject());dynamicSubject.operate();
    }
}
